package com.thirteenClassicsServer.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;

import com.thirteenClassics.annotation.AutoFill;
import com.thirteenClassics.entity.Entity;
import com.thirteenClassics.enumeration.OperationType;

@Mapper
public interface EntityMapper {
    List<Entity> selectBySentenceId(Long sentenceId, Long banben, String bookName);

    @Delete("delete from entity where sentence_id =#{sentenceId} and banben=#{banben} and book_name=#{bookName}")
    void deleteBySentenceId(Long sentenceId, Long banben, String bookName);

    @Insert("insert into entity (sentence_id, entity, entity_type, entity_explain, banben, book_name, entity_jdb, "
            + "create_time, create_user, update_user, update_time) "
            + "values (#{sentenceId}, #{entity}, #{entityType}, #{entityExplain}, #{banben}, #{bookName}, "
            + "#{entityJdb}, #{createTime}, #{createUser}, #{updateUser}, #{updateTime})")
    @AutoFill(OperationType.INSERT)
    void insert(Entity entity);
}
